package com.threeonemeeting.list;

import java.util.ArrayList;
import java.util.List;

import com.threeonemeeting.model.MeetingImageInfo;

public class MeetingImageInfoList {

	public List<MeetingImageInfo> listImage = new ArrayList<MeetingImageInfo>();

	public void addImage(MeetingImageInfo info) {
		if (info == null)
			return;

		listImage.add(info);
	}

	public void addImage(int nId, String strOrginalUrl, String strOrginalPath,
			String strThumbUrl, String strThumbPath) {

		MeetingImageInfo info = new MeetingImageInfo();
		info.strOrignalImageUrl = strOrginalUrl;
		info.strOrignalImagePath = strOrginalPath;
		info.strThumbUrl = strThumbUrl;
		info.strThumbPath = strThumbPath;

		listImage.add(info);
	}

	public MeetingImageInfo getImageInfo(int nId) {
		for (int i = 0; i < listImage.size(); i++) {
			MeetingImageInfo info = listImage.get(i);
			if (info == null)
				continue;

			if (info.nMeetingId == nId)
				return info;
		}

		return null;
	}

	public void updateOrginalPath(int nId, String strOriginalPath) {
		MeetingImageInfo info = getImageInfo(nId);
		if (info != null) {
			info.strOrignalImagePath = strOriginalPath;
		}
	}

	public void updateThumbUrl(int nId, String strThumbUrl) {
		MeetingImageInfo info = getImageInfo(nId);
		if (info != null) {
			info.strThumbUrl = strThumbUrl;
		}
	}

	public void updateThumbPath(int nId, String strThumbPath) {
		MeetingImageInfo info = getImageInfo(nId);
		if (info != null) {
			info.strThumbPath = strThumbPath;
		}
	}
}
